{
  "properties" : { },
  "id" : "copy1730275590985d90529",
  "script" : null,
  "groupId" : "c0cf605f74e34bc6953194a869f4a6cd",
  "name" : "FX_PREC地区累计降雨数据",
  "createTime" : 1732780546966,
  "updateTime" : 1730792053867,
  "lock" : null,
  "createBy" : "admin",
  "updateBy" : "admin",
  "path" : "/regionprec",
  "method" : "GET",
  "parameters" : [ {
    "name" : "stationkey",
    "value" : "",
    "description" : "必须填写 站ID",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "btime",
    "value" : "2024-10-20T13:00:00",
    "description" : "开始时间",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "pass",
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "etime",
    "value" : "2024-10-21T13:00:00",
    "description" : "结束时间",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "pass",
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "page",
    "value" : "1",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "size",
    "value" : "20",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "regioncode",
    "value" : "220099",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 0,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 2,\n        \"list\": [\n            {\n                \"stationKey\": \"54285\",\n                \"regioncode\": \"220099\",\n                \"regionname\": \"安图县\",\n                \"regionfullname\": \"延边朝鲜族自治州安图县\",\n                \"orgid\": \"220099\",\n                \"prec\": 0.1,\n                \"stationName\": \"二道\"\n            },\n            {\n                \"stationKey\": \"54287\",\n                \"regioncode\": \"220099\",\n                \"regionname\": \"安图县\",\n                \"regionfullname\": \"延边朝鲜族自治州安图县\",\n                \"orgid\": \"220099\",\n                \"prec\": 1.2,\n                \"stationName\": \"天池\"\n            }\n        ]\n    },\n    \"timestamp\": 1730773775150,\n    \"executeTime\": 70\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "Hello magic-api",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1723701688631",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "174",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
/**
 *   地区累计降雨数据 
 *  @param   stationkey  查询指定站点编码
 */
var sql = """
   select a.stationKey,a.regioncode,a.regionname,a.regionfullname,orgid,b.prec,a.stationName from region_info a
    ,(
    select  stationKey,sum(prec) as prec  from stationdata_region   
    where 1 = 1 
    
     <if test="stationkey != null and stationkey != ''" > and stationKey = #{stationkey} </if>
     <if test="btime != null and btime != ''\" > and DATE_FORMAT(#{btime}, '%Y-%m-%d %H:%i:%s') <= timeBase </if>
     <if test="etime != null and etime != ''\" > and DATE_FORMAT(#{etime}, '%Y-%m-%d %H:%i:%s') >= timeBase </if>
     and prec < 100 
     group by stationKey) as b
     where a.stationkey = b.stationkey and 1 = 1
    <if test="regioncode != null and regioncode != ''" > and a.orgid LIKE CONCAT(#{regioncode},'%') </if>
    order by orgid 
"""
    
return db.page(sql);